package com.neouton.common.util;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.io.Serializable;
import java.util.List;

public class PageUtil<T> implements Serializable {

    private static final long serialVersionUID = 2665029460120894493L;

    private Long total; // 返回的总数目

    private Long current; // 当前页码

    private Long size; // 每页行数

    private List<?> records;//返回的数据

    public PageUtil(IPage iPage) {
        this.records = iPage.getRecords();
        this.current = iPage.getCurrent();
        this.total = iPage.getTotal();
        this.size = iPage.getSize();
    }

    public PageUtil(Long total, Long size, Long current, List<?> records) {
        this.records = records;
        this.current = current;
        this.total = total;
        this.size = size;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<?> getRecords() {
        return records;
    }

    public void setRecords(List<?> records) {
        this.records = records;
    }

    public Long getCurrent() {
        return current;
    }

    public void setCurrent(Long current) {
        this.current = current;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }
}
